Aligning an Image

A Web page can have a combination of both text and images. While adding an image to the Web page, you need to align an image. Otherwise, the text or other elements can wrap around the image element, as this element does not insert a new line on a Web page. Therefore, the align attribute of the <img> tag is used to align an image on a Web page. This attribute can take one of the following five value: top, bottom, left, right, or center. By default, an image aligns to the Web page.

Let’s do the following steps to align an image:


<!DOCTYPE html>
<html>
<head>
    <title> Image </title>
</head>
<body>
    <h1>Aligning An Image</h1>
    <p align=”right”><font color=”darkred” size=”4”>I am RIGHT now !!!!!!</font></p>
    <img src=”images\globe.jpg” alt=”Globe Cartoon” />
    <p><font color=”darkred” size=”5”> Image with border</font></p>
    <img src=”image\globe.jpg” alt=”Global Teacher” border=”7” align=”right” />
</body>
</html>

Save the document with the name of AligningImage.html and open on browser.